# Maintainer: Santiago Torres-Arias <santiago@archlinux.org>

pkgname=bashbrew
pkgver=0.1.1
pkgrel=2
pkgdesc="Canonical build tool for Docker official images"
arch=('loong64' 'x86_64')
url="https://github.com/docker-library/bashbrew/"
license=('Apache')
depends=('docker' 'git')
makedepends=('go' 'git')
checkdepends=()
source=("git+https://github.com/docker-library/bashbrew?tag=${pkgver}")
sha256sums=('SKIP')

build() {
    cd "${pkgname}"
    export CGO_LDFLAGS="${LDFLAGS}"
    export CGO_CFLAGS="${CFLAGS}"
    export CGO_CPPFLAGS="${CPPFLAGS}"
    export CGO_CXXFLAGS="${CXXFLAGS}"
    export GOFLAGS="-buildmode=pie -trimpath -modcacherw"
    go build -o "${pkgname}" ./cmd/...
}

check() {
    cd "${pkgname}"
    go test ./...
}

package() {
    cd "${pkgname}"
    install -m755 -Dt "${pkgdir}/usr/bin/" "${pkgname}"
}
